package com.nkzy.pojo;

public class Result<T> {
    private int code; // 状态码
    private String message; // 返回消息
    private T data; // 返回数据

    // 成功返回结果，带数据
    public Result(T data) {
        this.code = 200;
        this.message = "成功";
        this.data = data;
    }

    // 失败返回结果，带错误消息
    public Result(String message) {
        this.code = 500;
        this.message = message;
        this.data = null;
    }

    // 成功返回结果，不带数据
    public Result() {
        this.code = 200;
        this.message = "成功";
        this.data = null;
    }

    // Getter和Setter方法
    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}